package com.home.school.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.home.school.bean.TTeacherSubject;
import com.home.school.mapper.TTeacherSubjectMapper;
import com.home.school.service.TTeacherSubjectService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

@Service
public class TTeacherSubjectServiceImpl extends ServiceImpl<TTeacherSubjectMapper, TTeacherSubject> implements TTeacherSubjectService {

    @Override
    public void deletedBySubjectId(String num) {
        QueryWrapper<TTeacherSubject> wrapper = new QueryWrapper<>();
        wrapper.eq("suject_id", num);
        baseMapper.delete(wrapper);
    }

    @Override
    public TTeacherSubject findBySubjectId(String num) {
        QueryWrapper<TTeacherSubject> wrapper = new QueryWrapper<>();
        wrapper.eq("suject_id", num);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public List<TTeacherSubject> findByTeacherId(String teacherId) {
        QueryWrapper<TTeacherSubject> wrapper = new QueryWrapper<>();
        wrapper.eq("tea_id", teacherId);
        return baseMapper.selectList(wrapper);
    }
}
